z/OS MVS Programming: Callable Services for High-Level Languages
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Usage example of a System z authorized service

z/OS MVS Programming: Callable Services for High-Level Languages
SA23-1377-02

Start of change

The following example uses the authorized services to perform compression using zEDC Express. Note: If zEDC Express adapters are not available, data is written to the destination uncompressed.

The FPZ4PRB service is called intermittently after the FPZ4ABC service returns to the application with a return code that indicates that all zEDC devices have left the configuration.

Call FPZ4RZV(AppId, RzvOptions, RzvUserId, RzvToken, RetCode, RsnCode)                                  /* Rendezvous with the compression
                                                                                                           device driver (once per address
                                                                                                           space) */

If RetCode = RcNoDevices Then                                                                           /* If no devices available */
  NoDevices = ON                                                                                        /* Indicate no devices */

Call FPZ4RMR(AppId, RmrOptions, RzvToken, InBuffer@, InBufferLen, 0, InBufKey, InRmrToken, 
              RetCode, RsnCode)                                                                         /* Register the input buffer */
Call FPZ4RMR(AppId, RmrOptions, RzvToken, OutBuffer@, OutBufferLen, 0, OutBufKey, OutRmrToken, 
              RetCode, RsnCode)                                                                         /* Register the output buffer for
                                                                                                           compressed data */

Do Until End of Data
	Read next block of data into InBuffer@
	
        If NoDevices = ON Then                                                                          /* If no devices available */
                Call FPZ4PRB(AppId, Options, NumDevices, RetCode, RsnCode)                              /* Probe for new devices */

                If RetCode = RcOk Then                                                                  /* If devices now available */
                        NoDevices = OFF                                                                 /* Indicate we have devices */
                Else                                                                                    /* Else no devices */
                        Write InBuffer                                                                  /* Processed uncompressed data */

        If NoDevices = OFF Then                                                                         /* If devices available */
		Call FPZ4ABC(RzvToken,
				InBuffer@, InBufferLen, InRmrToken,
				OutBuffer@, OutBufferLen, OutRmrToken,
                                RetCode, RsnCode)                                                       /* Perform compression */

                If RetCode = RcOk Then                                                                  /* If data was compressed */
                        Write OutBuffer                                                                 /* Process compressed data */
                Else If RetCode = RcNoDevices Then                                                      /* If no devices available */
                        NoDevices = ON                                                                  /* Indicate no devices */
                Write InBuffer                                                                          /* Process uncompressed data */
End Loop

Call FPZ4DMR(DmrOptions, RzvToken, InRmrToken, RetCode, RsnCode)
Call FPZ4DMR(DmrOptions, RzvToken, OutRmrToken, RetCode, RsnCode)
End of change

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014